package iterator.iterator;

import iterator.Iterator;
import iterator.impl.PersonContainer;

public class PersonIterator implements Iterator {
    PersonContainer container;
    int curr = 0;

    public PersonIterator(PersonContainer container) {
        this.container = container;
    }

    @Override
    public boolean hasNext() {
        return (++curr < container.size) && (container.container[curr] != null);
    }

    @Override
    public Object next() {
        return container.container[curr];
    }
}
